package com.my.study.guava.retry;

import com.github.rholder.retry.WaitStrategies;
import com.github.rholder.retry.WaitStrategy;
import org.junit.Test;

import java.util.concurrent.TimeUnit;

/**
 *
 *
 * @author: yidujun
 * @create: 2021/07/20 10:45
 */
public class WaitTest {

    @Test
    public void test01() {
        WaitStrategy waitStrategy = WaitStrategies.noWait();
        long sleepTime = waitStrategy.computeSleepTime(null);
        System.out.println(sleepTime);
    }

    @Test
    public void test02() {
        WaitStrategy waitStrategy = WaitStrategies.randomWait(100, TimeUnit.SECONDS);
        long sleepTime = waitStrategy.computeSleepTime(null);
        System.out.println(sleepTime);
    }

    @Test
    public void test03() {
        double pow = Math.pow(2, 2);
        long round = Math.round(3 * pow);
        System.out.println(round);
    }
}
